package com.banksoft.admin.entity;

import com.banksoft.util.DateUtil;

import java.util.Date;

/**
 * 商品
 * Created by Administrator on 2016/11/27.
 */
public class Product {

    private String id;
    private String name; //商品名称
    private String description; //简介
    private String price; //商品销售价格
    private String marketPrice;//市场价格
    private String images; //多图
    private int stock; //库存，  推广商品无库存
    private int saleCount; //销量
    private String content; //详情
    private String status; //状态 NORMAL 上架  FROZEN 下架
    private Long createTime;
    private Integer sort; //前台排序
    //以下不存数据库
    private String dateStr; //时间
    private String num;//数量

    private ProductParam productParam;

    //JSONObect转换时 若为空 报错 手动处理
    public ProductParam getProductParam() {
        if(productParam==null)
            productParam = new ProductParam();
        return productParam;
    }

    public void setProductParam(ProductParam productParam) {
        this.productParam = productParam;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getMarketPrice() {
        return marketPrice;
    }

    public void setMarketPrice(String marketPrice) {
        this.marketPrice = marketPrice;
    }

    public String getImages() {
        return images;
    }

    public void setImages(String images) {
        this.images = images;
    }

    public int getStock() {
        return stock;
    }

    public void setStock(int stock) {
        this.stock = stock;
    }

    public int getSaleCount() {
        return saleCount;
    }

    public void setSaleCount(int saleCount) {
        this.saleCount = saleCount;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getDateStr() {
        if(createTime!=null)
            return DateUtil.getDateFromLong(createTime);
        return dateStr;
    }

    public void setDateStr(String dateStr) {
        this.dateStr = dateStr;
    }
}
